import 'dart:async';
import 'dart:io';
import 'package:flick_video_player/flick_video_player.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_full_pdf_viewer/full_pdf_viewer_scaffold.dart';
import 'package:path_provider/path_provider.dart';

import 'package:flutter/cupertino.dart';
import 'package:video_player/video_player.dart';



class PlayVideoPage extends StatefulWidget {
  @override
  final String  _videoUrl;
  final bool isnetwork ;
  PlayVideoPage(this._videoUrl,this.isnetwork);
  _MyAppState createState() => new _MyAppState(this._videoUrl,this.isnetwork);
}

class _MyAppState extends State<PlayVideoPage> {
  final String  url;
  final bool isnetwork ;
  _MyAppState(this.url,this.isnetwork);
 
 FlickManager flickManager;
 
  @override
  void initState() {
    super.initState();
    flickManager = FlickManager(
      videoPlayerController:
         isnetwork? VideoPlayerController.network(this.url):VideoPlayerController.file(File(this.url)),
    );
  }

  void dispose() {
    super.dispose();
    flickManager.dispose();
  }

  

  @override
  Widget build(BuildContext context) {
    
    return Scaffold(
      appBar: AppBar(title: const Text('视频'), backgroundColor: Colors.white),
      body: Center(
        child:
        Padding(padding: new EdgeInsets.fromLTRB(0, 0, 0, 0),child:
        FlickVideoPlayer(
        flickManager: flickManager
      )),

      ),
    );
  }
}